package demo1;

import java.util.InputMismatchException;
import java.util.Scanner;

public class TestFinally {
    public static int getNum() {
        Scanner scanner = null;
        try {
            scanner = new Scanner(System.in);
            int data = scanner.nextInt();
            return data;
        } catch (InputMismatchException e) {
            e.printStackTrace();
        } finally {
            System.out.println("finally内代码被执行了");
        }
        System.out.println("finally后面代码被执行了");
        if(scanner != null) {
            scanner.close();
        }
        return 0;
    }
    public static void main(String[] args) {
        int data = getNum();
        System.out.println(data);
    }
}